/**
 * 读取配置文件参数
 */
package com.flute.search.util;

import java.util.Properties;

import com.flute.search.constants.SearchServiceConstants;

/**
 * @author Jazz
 * 
 */
public final class Parameters {
	private static String indexDirectory;
	private static Parameters instance = new Parameters();

	public static Parameters getInstance() {
		if (instance == null) {
			instance = new Parameters();
		}
		return instance;
	}

	private Parameters() {
		Properties prop = new Properties();
		try {
			prop.load(this.getClass().getClassLoader().getResourceAsStream(
					SearchServiceConstants.PARA_PROPERTIES));

			setIndexDirectory(prop.getProperty(
					SearchServiceConstants.INDEX_DIR,
					SearchServiceConstants.INDEX_NAME));

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static String getIndexDirectory() {
		return indexDirectory;
	}

	private static void setIndexDirectory(final String indexDirectory) {
		Parameters.indexDirectory = indexDirectory;
	}

}
